package logic

import (
	"activity_srv/internal/dao"
	"context"
	"errors"

	"activity_srv/activity"
	"activity_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetGrouponProductListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetGrouponProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGrouponProductListLogic {
	return &GetGrouponProductListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetGrouponProductListLogic) GetGrouponProductList(in *activity.GetGrouponProductListRequest) (*activity.GetGrouponProductListResponse, error) {
	// todo: add your logic here and delete this line
	list, err := dao.GrouponProductList(in)
	if err != nil {
		return nil, errors.New("拼团商品列表展示失败")
	}
	return &activity.GetGrouponProductListResponse{
		List: list,
	}, nil
}
